package com.hangxintong.jpa;

import com.hangxintong.common.base.dto.MessageFiles;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;

/**
 * @author Lenovo
 */
@Entity
@Data
@org.hibernate.annotations.Table(appliesTo = "lm_information",comment = "系统消息表")
@ApiModel(value="lm_information",description="系统消息表" )
public class LmInformation implements Serializable {

    @Id
    private String id;
    /**
     * 名称
     */
    @Column(nullable = false,columnDefinition="varchar(255) DEFAULT NULL COMMENT '标题'")
    @NotEmpty
    @Length(min=1)
    @ApiModelProperty(name="title",value = "标题",example="系统消息-站内信",required = true)
    private String title;

    @Column(nullable = false,columnDefinition="text COMMENT '内容'")
    @NotEmpty
    @Length(min=1)
    @ApiModelProperty(name="text",value = "标题",example="您在2020-04-02 12:46:10将您移出了团队",required = true)
    private String text;

    @Column(columnDefinition="int(11) DEFAULT NULL COMMENT '发件人id'")
    @Min(value=0)
    @ApiModelProperty(name="fjrId",value = "发件人id",example="123",required = true)
    private Integer fjrId;

    @Column(nullable = false,columnDefinition="varchar(255) DEFAULT NULL COMMENT '发件人名称")
    @Length(min=1)
    @ApiModelProperty(name="fjrName",value = "发件人名称",example="行信通平台",required = true)
    private String fjrName;

    @Column(columnDefinition="int(11) DEFAULT NULL COMMENT '发件人id'")
    @Min(value=0)
    @ApiModelProperty(name="sjrId",value = "收件人id",example="123",required = true)
    private Integer sjrId;

    @Column(nullable = false,columnDefinition="varchar(255) DEFAULT NULL COMMENT '发件人名称")
    @Length(min=1)
    @ApiModelProperty(name="sjrName",value = "收件人名称",example="小王",required = true)
    private String sjrName;

    @Column(columnDefinition="int(11) DEFAULT '1' COMMENT '1未读  2已读'")
    @Min(value=1)
    @ApiModelProperty(name="status",value = "状态",example="1",required = true)
    private int status=1;

    @Column(columnDefinition="int(11) DEFAULT '1' COMMENT '1系统 2评论 3提醒'")
    @Min(value=0)
    @ApiModelProperty(name="cate",value = "类型",example="1",required = true)
    private int cate;

    @Column(columnDefinition="int(11) DEFAULT '0'")
    @Min(value=0)
    @ApiModelProperty(name="isDelete",value = "是否删除",example="0",required = true)
    private int isDelete;

    @Column(columnDefinition="datetime DEFAULT NULL")
    @ApiModelProperty(name="deleteTime",value = "删除时间",example="2012-02-09",required = true)
    private String deleteTime;

    @Column(nullable = false,columnDefinition="createTime DEFAULT NULL")
    @ApiModelProperty(name="createTime",value = "创建时间",example="2012-02-09",required = true)
    private String createTime;

    @Column(nullable = true,columnDefinition="files DEFAULT NULL")
    @ApiModelProperty(name="files",value = "附件信息",example="[{\n" +
            "\t\"url\": \"https://res.hangxintong.cn/20200904/8c3a3c73-c218-44ae-b700-9e85d61d0229.png\",\n" +
            "\t\"name\": \"装修装饰通知书\",\n" +
            "\t\"type\": \"image\"\n" +
            "}]",required = false)
    private String files;

   @Column(nullable = true,columnDefinition="parames DEFAULT NULL")
   @ApiModelProperty(name="parames",value = "参数json",example="{\n" +
           "\t\"id\": \"123456789\",\n"+
           "}",required = false)
   private String parames;

  @Column(columnDefinition="varchar(36) DEFAULT '0'")
  @ApiModelProperty(name="pid",value = "被回复ID",example="0",required = false)
  private String pid;

  @Column(columnDefinition="int(11) DEFAULT '0'")
  @Min(value=0)
  @ApiModelProperty(name="IsReply",value = "是否需要回复",example="0")
  private Integer IsReply=0;

  @Column(columnDefinition="varchar(36) DEFAULT '0'")
  @Min(value=0)
  @ApiModelProperty(name="createId",value = "发件人ID",example="0",required = false)
  private String createId;

  @Column(columnDefinition="int(1) DEFAULT '0'")
  @Min(value=0)
  @ApiModelProperty(name="uType",value = "回复者类型",example="0")
  private Integer utype=0;

  @Transient
  private List<MessageFiles> listFiles;
}
